# Copyright (c) 2008-2009 Mikhail Chernov 
#
# This file is part of dcExplorer.
#
# dcExplorer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# dcExplorer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dcExplorer.  If not, see <http://www.gnu.org/licenses/>.

package dcExplorer::server::Command;
use strict;
use utf8;

# Construction methods

sub new 
{
	my $proto = shift;
	my $class = ref($proto) || $proto;
	my $self = {};
	$self->{Name} = shift;
	$self->{Params} = shift;
	bless ($self, $class);
	return $self;
}

sub getXML
{	
	my $self = shift;
	my $id = shift;
	my $xml = '<act name="'.$self->{Name}.'" id="'.$id.'">';
	for my $param (reverse keys %{$self->{Params}})
	{
		$xml .= '<'.$param.'>'.$self->{Params}->{$param}.'</'.$param.'>';
	}
	$xml .= '</act>';
	return $xml;
}

1;
